package com.xuyiwei.xblog.core.base.constant.enums;

import com.xuyiwei.xblog.core.base.constant.ConstantStatusInterface;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by xuyiwei on 2018/12/2.
 */
public enum HomePageDisplay implements ConstantStatusInterface<Integer,String> {

    NULL(null, ""),
    MAIN(1, "是"),
    NOT(0, "否"); //不是菜单的是按钮

    private Integer key;
    private String desc;

    HomePageDisplay(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    static Map<Integer, HomePageDisplay> map = new HashMap<>();

    static {
        for (HomePageDisplay bst : HomePageDisplay.values()) {
            map.put(bst.key, bst);
        }
    }

    public static HomePageDisplay convert(Integer key) {
        HomePageDisplay type = map.get(key);
        return (type != null) ? type : NULL;
    }

    @Override
    public Integer getKey() {
        return key;
    }

    @Override
    public String getDesc() {
        return desc;
    }
}
